package com.xiaoquan.myspring.Test;

import com.xiaoquan.myspring.SpringIOC.step1.BeanDefinition;
import com.xiaoquan.myspring.SpringIOC.step1.BeanFactory;

/**
 * @Author: 周海权
 * @CreateTime: 2024-08-30
 * @Description:
 * @Version: 1.0
 */
public class test_BeanFactory {
    public static void main(String[] args) {
        BeanFactory beanFactory = new BeanFactory();
        // 2.注册 bean
        BeanDefinition beanDefinition = new BeanDefinition(new UserService());
        beanFactory.registerBeanDefinition("userService", beanDefinition);
        // 3.获取 bean
        UserService userService = (UserService) beanFactory.getBean("userService");
        userService.queryUserInfo();
    }
}

